package logic

import (
	"context"
	"src/models/mysql"

	"src/internal/svc"
	"src/src"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodShowLogic {
	return &GoodShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GoodShowLogic) GoodShow(in *src.GoodShowRequest) (*src.GoodShowResponse, error) {
	// todo: add your logic here and delete this line

	var Show mysql.Good
	mysql.DB.Debug().Model(&Show).Where("id = ?", in.Id).Find(&Show)

	return &src.GoodShowResponse{
		Title:       Show.Title,
		Price:       int64(Show.Price),
		Stock:       int64(Show.Stock),
		Status:      Show.Status,
		LikeCollect: int64(Show.LikeCollect),
		Id:          int64(Show.ID),
	}, nil
}
